export interface ResumeResult {
  id: string;
  createdAt: string;
  createdBy: string | null;
  fullName: string | null;
  image: string;
  isTemplate: string;
  jsonString: string;
  remarks: string;
  updatedAt: string;
  updatedBy: string | null;
}

export async function getResumeList(): Promise<ResumeResult[]> {
  console.log(
    "process.env.NEXT_PUBLIC_API_URL: ",
    process.env.NEXT_PUBLIC_API_URL
  );
  const data = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/resume/list`);
  const res = await data.json();
  return res.list;
}

export async function getResume(id: string): Promise<ResumeResult> {
  const data = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/resume/item`, {
    method: "POST",
    body: JSON.stringify({ id }),
    headers: {
      "Content-Type": "application/json",
    },
  });
  const res = await data.json();
  return res.result;
}
